package com.sghd.football.robot.action;

import com.sghd.common.socket.client.Client;
import com.sghd.common.socket.core.Message;
import com.sghd.common.utils.math.RandomUtils;
import com.sghd.football.robot.core.Robot;
import com.sghd.football.utils.SocketEnum;

import java.util.HashMap;
import java.util.Map;

/**
 * @author wch
 * @date 2018-07-06 17:26
 * @desc 旋转
 **/
public class OpAction extends AbstractAction {
    @Override
    public Stage stage() {
        return Stage.OP;
    }

    public static Integer[] bets = new Integer[]{100, 500, 1000, 5000, 10000, 30000, 50000, 80000};

    @Override
    public void action(Robot robot) {
        if (!check(robot)) {
            return;
        }
        Client client = robot.getClient();
        Map<String, Object> opReq = new HashMap<>();

        final Integer bet = RandomUtils.nextInt(bets.length);
        opReq.put("allBet", bet);
        robot.setLastBet(bet);
        client.send(Message.valueOf(SocketEnum.OPERATRO, opReq));
    }
}
